package cn.edu.just.firstjavaapp.l4;

public class D2ArrayDemo {
    public static void main(String[] args){
        //定义二维数组，同时初始化
        int[][] matrix = {{1,2,3,9,3},{4,5,6},{11,12,7,8,9}};
        for(int[] a:matrix){
            for(int x:a){
                System.out.print(x+" ");

            }
            System.out.println();
        }
        System.out.println("-----------");
        //先定义，再初始化
        int[][] m2;
        m2 = new int[3][];
        m2[0] = new int[2];
        m2[1] = new int[3];
        m2[2] = new int[14];

        m2[2][2] = 100;
        for(int[] a:m2){
            for(int x:a){
                System.out.print(x+" ");
                System.out.println(Math.random());
            }
            System.out.println();
        }
    }
}
